package com.kuang.Test;

import com.kuang.bean.User;
import com.kuang.service.UserServiceImpl;
import com.kuang.utils.GetTime;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.text.SimpleDateFormat;
import java.util.List;

public class UserTest {
    public static void main(String[] args) {
        ApplicationContext ioc = new ClassPathXmlApplicationContext("applicationContext.xml");
        MenuService userService = ioc.getBean(MenuServiceImpl.class);
        List<Menu> list = userService.findChildernList(62);
        for (Menu m:list
             ) {
            System.out.println(m);
        }




        System.out.println(ioc.getBean(UserServiceImpl.class));
//        user user = new user();
//        user.setId(545l);
//        userService.insertAUser(user);
        List<User> users = userService.queryByTime();
        for (User user: users
             ) {
            System.out.println(user.getUserId()+"  "+user.getUsername()+"  "+user.getPassword());
        }
        System.out.println(userService.queryCountById());
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        GetTime getTime = new GetTime();
        System.out.println(df.format(getTime.getBefore())+df.format(getTime.getNow()));

            }

}
